package cn.wolfcode.wolf2w.job;

import cn.wolfcode.wolf2w.domain.vo.StrategyStatisVO;
import cn.wolfcode.wolf2w.redis.IRedisStatisService;
import cn.wolfcode.wolf2w.service.IStrategyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

//@Component
public class RedisDataPersistencejob{
    @Autowired
    private IRedisStatisService statisService;
    @Autowired
    private IStrategyService strategyService;


    @Scheduled(cron = "0/10 * * * * ?")
    public void doWork(){
        System.out.println("-----------------------Start----------------------");

        List<StrategyStatisVO> statisVOList = statisService.getStatisVoList("*");

        for (StrategyStatisVO vo : statisVOList) {
            strategyService.updateStragegyList(vo);
        }

        System.out.println("-----------------------End----------------------");
    }
}
